import request from '@/utils/request'

// 查询缺陷设备列表
export function listDefects(query) {
    return request({
        url: '/ar_check/defects/list',
        method: 'get',
        params: query
    })
}

// 查询缺陷设备详细
export function getDefects(defectId) {
    return request({
        url: '/ar_check/defects/' + defectId,
        method: 'get'
    })
}

// 新增缺陷设备
export function addDefects(data) {
    return request({
        url: '/ar_check/defects',
        method: 'post',
        data: data
    })
}

// 修改缺陷设备
export function updateDefects(data) {
    return request({
        url: '/ar_check/defects',
        method: 'put',
        data: data
    })
}

// 删除缺陷设备
export function delDefects(defectId) {
    return request({
        url: '/ar_check/defects/' + defectId,
        method: 'delete'
    })
}

// 派遣任务
export const dispatchRepair = (data) => request.put('/ar_check/defects/dispatchRepair', data)

// 根据班组查询缺陷设备
export const getTeamByIdDefect = (id) => request.get(`/ar_check/defects/team/${id}`)

// 根据机房查询缺陷设备
export const getRoomByIdDefect = (id) => request.get(`/ar_check/defects/room/${id}`)

// 根据巡检计划查询缺陷设备
export const getPlanByIdDefect = (id) => request.get(`/ar_check/defects/plan/${id}`)
